<template>
  <div id="app">
    <el-container>
      <el-header style="padding: 0">
        <Header />
      </el-header>
      <el-container style="padding-bottom: 80px">
        <el-aside width="180px"><Sidebar /></el-aside>
        <el-main><router-view :key="$route.fullPath"></router-view></el-main>
      </el-container>
      <Footer />
    </el-container>
    <transition name="pop">
      <RightSidebar v-show="$store.state.rightSidebar.isShowSidebar" />
    </transition>
  </div>
</template>

<script>
import Header from "@/components/Header";
import Sidebar from "@/components/Sidebar";
import Footer from "@/components/Footer";
import RightSidebar from "@/components/RightSidebar";
export default {
  name: "App",
  components: {
    Header,
    Sidebar,
    Footer,
    RightSidebar,
  },
  mounted() {
    // 获取用户信息
    if (localStorage.getItem("uid") !== null) {
      let uid = localStorage.getItem("uid");
      this.$store.dispatch("getUserInfo", uid);
    }
  },
};
</script>

<style lang="less">
// 侧边栏过度动画
.pop-enter-active,
.pop-leave-active {
  transition: 0.5s;
}
.pop-enter, 
.pop-leave-to /* .fade-leave-active below version 2.1.8 */ {
  transform: translateX(440px);
}
</style>
